import axios from 'axios'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
const url = process.env.VUE_APP_BASEURL;

const service = axios.create({
  baseURL: url
})
NProgress.configure({
  showSpinner: false
})

service.interceptors.request.use(config => {
  NProgress.start() // start progress bar
  return config
}, error => {
  console.log('err' + error) // for debug
  return Promise.reject(error)
});

service.interceptors.response.use(data => {
  NProgress.done();
  return data
}, res => {
  console.log(res)
  NProgress.done();
});


export default service
